<?php
function maxkey($arr){
    $maxval=max($arr);
    foreach($arr as $key=>$val){
        if($maxval==$val){
            $maxkey=$key;
        }
    }
    return $maxkey;
}
$arr=array(0,-1,-2,5,"b"=>15,3);
echo maxkey($arr);

/*function maxkey($arr){
foreach ($arr as $i){
echo $i;
}


}

$arr=array(0,-1,-2,5,"b"=>15,3);

echo maxkey($arr);
*/

?>